package com.project.template.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.template.entity.Image;
import com.project.template.mapper.ImageMapper;
    import com.project.template.service.ImageService;
import org.springframework.stereotype.Service;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Collection;
import java.util.List;
import java.util.Map;

@Service
        public class ImageServiceImpl extends ServiceImpl<ImageMapper, Image> implements ImageService{

        @Override
        public boolean save(Image entity) {
        check(entity);
        return super.save(entity);
        }

        @Override
        public boolean updateById(Image entity) {
        check(entity);
        return super.updateById(entity);
        }

        private void check(Image entity) {
        }


        @Override
        public boolean removeByIds(Collection<?> list) {
        List<Integer> integerList = (List<Integer>) list;
        return super.removeByIds(integerList);
        }

        @Override
        public Page<Image> page(Map<String, Object> query, Integer pageNum, Integer pageSize) {
        LambdaQueryWrapper<Image> wrapper = new LambdaQueryWrapper<>();
        wrapper.orderByDesc(Image::getId);
            if (ObjectUtils.isNotEmpty(query.get("name"))) {
            }
        return page(new Page<>(pageNum, pageSize), wrapper);
        }
}
